package com.xinyu.shopping_goods_service.service;

import com.xinyu.shopping_common.enums.CodeEnum;
import com.xinyu.shopping_common.exception.BusException;
import com.xinyu.shopping_goods_service.mapper.BrandMapper;
import com.xinyu.shopping_common.entity.Brand;
import com.xinyu.shopping_common.service.IBrandService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;


@DubboService
public class BrandServiceImpl implements IBrandService {

    @Autowired
    private BrandMapper brandMapper;
    @Override
    public Brand findById(Long id) {

        //如果id小于1 抛出一个逻辑异常，参数错误
        if (id<1){
            throw new BusException(CodeEnum.PARAMETER_ERROR);
        }

        return brandMapper.selectById(id);
    }
}
